home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_10.lha
/
5_10
/
5_10a.h
next >
Wrap
C/C++ Source or Header
|
1993-08-08
|
1KB
|
62 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ exercise 5.10
/ class table
ifndef TABLE_H
define TABLE_H
include <string.h>
* declare the class which contains the names, */
* values and pointers for a list of these names */
truct name
char *string;
name *next;
union
{
double dvalue;
float fvalue;
void *pvalue;
void (*pfvalue)();
long lvalue;
short svalue;
unsigned long ulvalue;
unsigned short usvalue;
};
name(char *str)
{
string = new char[strlen(str) + 1];
strcpy(string, str);
dvalue = 0;
}
~name()
{
delete string;
}
;
lass table
name **tbl;
int size;
ublic:
table(int sz = 23);
~table();
name *look(char*, int = 0);
name *insert(char *s) { return look(s, 1); }
name *lookfor(char *s) { return look(s, 2); }
;
endif /* TABLE_H */